<script type="text/javascript" >
    batteryObj.loadUploadButton('100', 
    '<?php echo $this->url(array('controller' => 'service', 'action' => 'ajaxupload')) ?>',
        function (response){
            batteryObj.loadRemoveButton('<?php echo $this->url(array('controller' => 'service', 'action' => 'ajaxremove')) ?>', function(clickedObject){
                var post_data = "ajax=1&CourseLocationImageID="+clickedObject.attr('img_id');
                //        alert(post_data);
                jQuery.ajax({
                    type: "POST",
                    url: "<?php echo $this->url(array('controller' => 'translate', 'action' => 'deleteimage')) ?>",
                    data: post_data,
                    success: function(data){                
                    }
                });

            }, 'location');

        }, 'location', '#data-form'
    );
    batteryObj.loadRemoveButton('<?php echo $this->url(array('controller' => 'service', 'action' => 'ajaxremove')) ?>', function (clickedObject){

        var post_data = "ajax=1&CourseLocationImageID="+clickedObject.attr('img_id');
        //        alert(post_data);
        jQuery.ajax({
            type: "POST",
            url: "<?php echo $this->url(array('controller' => 'translate', 'action' => 'deleteimage')) ?>",
            data: post_data,
            success: function(data){                
            }
        });
        
    }, 'location');
</script>
<div class="w100p filter">
    <div class="float_right">
        <div class="float_left button_leftb m10r">
            <div class="button_rightb"><a href="<?php echo $this->url(array("action" => "location")); ?>">
                    <?php echo $this->translate->_("Back to location list"); ?>
                </a></div>
        </div>
        <div class="cl"></div>
    </div>
    <div class="cb"></div>
</div>
<div id="main">
    <div class="w950 mc bg_table po p15b">
        <div class="top_left"></div>
        <div class="top_right"></div>
        <div class="bottom_left"></div>
        <div class="bottom_right"></div>
        <h3 class="p15t p15l p15b bg_bot"><b><?php echo $this->translate->_("Add new location"); ?></b></h3>
        <div class="w920 mc p15t">
            <div class="float_left" style="width: 500px">
                <form id="data-form" onsubmit="return batteryObj.validateForm('data-form');" method="post">
                    <br class="clear" />
                    <label class="lbl2"><?php echo $this->translate->_("Location Name"); ?>:<em> *</em></label>
                    <input name="data[CourseLocationName]" value="" class="txt1 required" type="text" /><br class="clear" />

                    <label class="lbl2"><?php echo $this->translate->_("Caretaker Name"); ?>:<em> *</em></label>
                    <input name="data[CaretakerName]" value="" class="txt1 required" type="text" /><br class="clear" />
                    <label class="lbl2"><?php echo $this->translate->_("Caretaker Phone"); ?>:<em> *</em></label>
                    <input name="data[CaretakerPhone]" value="" class="txt1 required" type="text" /><br class="clear" />
                    <label class="lbl2"><?php echo $this->translate->_("Caretaker Email"); ?>:<em> *</em></label>
                    <input name="data[CaretakerEmail]" value="" class="txt1 required email" type="text" /><br class="clear" />

                    <label class="lbl2"><?php echo $this->translate->_("Description"); ?>:</label>
                    <textarea  name="data[CourseDescription]" class="area1" ></textarea>

                    <br class="clear" />
                    <?php
                    if ($_SESSION['userSchool'] != '') {
                        echo '<input name="data[SchoolID]" value="' . $_SESSION['userSchool'] . '" type="hidden" />';
                    } else {
                        ?>
                        <label class="lbl2"><?php echo $this->translate->_("Choose School"); ?>:</label>
                        <select class="txt1" name="data[SchoolID]">
                            <?php foreach ($this->schoolObj as $c) { ?>
                                <option value="<?php echo $c['SchoolID']; ?>"><?php echo $c['SchoolName']; ?></option>
                            <?php } ?>
                        </select>
                    <?php } ?>
                    <br class="clear" />
                    <label class="lbl2">&nbsp;</label>
                    <div class="float_left button_leftb m3r">
                        <div class="button_rightb"><a href="#"  onclick="if(batteryObj.validateForm('data-form')) document.forms[0].submit();"><?php echo $this->translate->_("Save"); ?></a></div>
                    </div><div class="float_left button_leftb">
                        <div class="button_rightb"><a href="<?php echo $this->url(array("action" => "location")); ?>"><?php echo $this->translate->_("Cancel"); ?></a></div>
                    </div>
                    
                </form>
            </div> 
            <div style="float:right;">
                <br class="clear" />
                <div  style="margin-bottom:10px" class="w400 bg_table po p15b">
                    <div class="top_left"></div>
                    <div class="top_right"></div>
                    <div class="bottom_left"></div>
                    <div class="bottom_right"></div>
                    <h3 class="p15t p15l p15b bg_bot" style="padding-bottom:5px">
                        <div style="float:left; width:130px">
                            <b><?php echo $this->translate->_("Location images"); ?></b>
                        </div>

                        <div class="float_right" style="font-size:12px">
                            <div class="float_left button_leftb m10r">
                                <div class="button_rightb">
                                    <a class="image_upload_button"
                                       id="upload_button"
                                       href="javascript:" ><?php echo $this->translate->_("Choose image"); ?>
                                    </a>
                                </div>
                            </div>
                        </div> 
                        <div class="cb"></div>  

                    </h3>
                    <div id="image_upload_button" class="imageLocation" style="padding-left: 25px">                            
                        <br clear="both" />
                    </div>
                </div>

            </div>
        </div>
        <div class="cb"></div>
    </div>
</div>
